﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Materials.aspx.cs" Inherits="PmSadis.WebFormsUi.Operator.Materials" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridLookup" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%--<asp:Content ID="materialsHead" ContentPlaceHolderID="head" runat="server">
</asp:Content>--%>
<asp:Content ID="materialsContent" ContentPlaceHolderID="content" runat="server">
    <link href="../Content/oper.materials.css" rel="stylesheet" type="text/css" />
    <h2>Материалы</h2>
    <asp:ScriptManager ID="materialsScriptManager" runat="server" />
    <!--materials data source-->
    <asp:ObjectDataSource ID="dsMaterials" runat="server" TypeName="PmSadis.WebFormsUi.Operator.Materials" SelectMethod="AllMaterials" InsertMethod="InsertMaterial" UpdateMethod="UpdateMaterial" DeleteMethod="DeleteMaterial" />
    <!--units data source-->
    <asp:ObjectDataSource ID="dsUnits" runat="server" TypeName="PmSadis.WebFormsUi.Operator.Materials" SelectMethod="Units" />
    <asp:UpdatePanel ID="materialsUpdatePanel" runat="server">
        <ContentTemplate>
            <dx:ASPxGridView ID="gvMaterials" runat="server" DataSourceID="dsMaterials" KeyFieldName="MaterialId"  OnInit="gvMaterials_Init" OnRowUpdating="gvMaterials_RowUpdating" OnRowInserting="gvMaterials_RowInserting">
                <Columns>
                    <dx:GridViewDataColumn FieldName="MaterialId" Visible="false" />
                    <dx:GridViewDataDateColumn FieldName="DateCreate" Visible="false" />
                    <dx:GridViewCommandColumn>
                        <NewButton Visible="true" />
                        <EditButton Visible="true" />
                        <DeleteButton Visible="true" />
                    </dx:GridViewCommandColumn>
                    <dx:GridViewDataTextColumn FieldName="Name" Caption="Наименование материала" />
                    <dx:GridViewDataTextColumn FieldName="Code" Caption="Код" />
                    <dx:GridViewDataComboBoxColumn FieldName="UnitId" Caption="Единица измерения">
                        <EditItemTemplate>
                            <dx:ASPxGridLookup ID="lucUnits" runat="server" DataSourceID="dsUnits" KeyFieldName="UnitId" Width="100%" OnInit="lucUnits_Init" SelectionMode="Single">
                            <GridViewProperties>
                                <Settings ShowFilterRow="true" ShowFilterRowMenu="true" />
                            </GridViewProperties>
                                <Columns>
                                    <dx:GridViewCommandColumn Caption="Выбрать" ShowSelectCheckbox="true" Width="50" />
                                    <dx:GridViewDataTextColumn FieldName="Name" Caption="Наименование" />
                                </Columns>
                            </dx:ASPxGridLookup>
                        </EditItemTemplate>
                        <PropertiesComboBox DataSourceID="dsUnits" ValueField="UnitId" ValueType="System.Int32" TextField="Name" />
                    </dx:GridViewDataComboBoxColumn>
                    <dx:GridViewDataSpinEditColumn FieldName="CostBase" Caption="Базовая стоиомость">
                        <PropertiesSpinEdit DisplayFormatString="{0:c}" DecimalPlaces="2" />
                    </dx:GridViewDataSpinEditColumn>
                </Columns>
            </dx:ASPxGridView>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
